<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        var fn=function()
        {
            console.log(fn)
        };
        fn();
        
        var obj=
        {
            fn2:function()
            {
                //console.log(fn2);报错，作用域不同，不能直接使用
                console.log(obj.fn2);//输出obj里面的fn2属性（函数）
            }
        };
        obj.fn2();
    </script>
</head>
<body>
    
</body>
</html>